<?php

namespace app\Admin\model;

use think\Model;
use traits\model\SoftDelete;

class Good extends Model
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $table = "goods_week2";

    public function addGood($data){
        $good = new Good;
        $good->pic=$data['pic'];
        $good->goods_name = $data['goods_name'];
        $good->count = $data['count'];
        $good->price = $data['price'];
        $good->goods_type = $data['goods_type'];
        $good->business = $data['business'];
        $good->addtime = $data['addtime'];
        $good->number = $data['number'];
        return $good->save();
    }

    public function getAll(){
        return Good::paginate(3);
    }

    public function delGood($id){
        return Good::destroy($id);
    }
}
